package com.unswift.enums;

import com.unswift.annotation.api.Api;
import com.unswift.annotation.api.ApiConstructor;
import com.unswift.annotation.api.ApiField;

@Api(value="异常枚举，定义系统核心异常，系统有三级异常，<br>"
		+ "<indent/>1、系统异常(放在ExceptionEnum类中);<br>"
		+ "<indent/>2、架构异常(放在exception.xml文件中);<br>"
		+ "<indent/>3、业务异常(放在数据库表中);", author="unswift", date="2023-04-08", version="1.0.0")
public enum ExceptionEnum {
	SET_FIRST_LANGUAGE("set.first.language", "100", "CN", "请先设定语言及特定语言的消息"),
	PARSE_MESSAGE_XML("parse.exception.message", "101", "CN", "解析XML文件消息异常，消息：%s"),
	MESSAGE_NOT_EXIST("message.not.exists", "102", "CN", "消息Key“%s”尚未配置"),
	CLASS_FOR_NAME("class.for.name", "103", "CN", "类名称%s加载失败，消息：%s"),
	CLASS_INSTANCE_EXCEPTION("class.instance.exception", "104", "CN", "类%s实例化异常，消息：%s"),
	EXCEPTION_NO_CONFIGURED_BEAN("exception.no.configured.bean", "105", "CN", "异常(%s)未配置异常Bean"),
	CANNOT_FIND_EXCEPTION_BEAN("cannot.find.exception.bean", "106", "CN", "无法找到异常Bean(%s)"),
	;
	@ApiField("异常key")
	private String key;
	@ApiField("异常code")
	private String code;
	@ApiField("异常消息的语言")
	private String language;
	@ApiField("异常消息")
	private String message;
	
	@ApiConstructor(value="异常枚举构造函数", params={@ApiField("异常key"), @ApiField("异常code"), @ApiField("异常消息的语言"), @ApiField("异常消息")})
	private ExceptionEnum(String key, String code, String language, String message) {
		this.key = key;
		this.code = code;
		this.language = language;
		this.message = message;
	}
	
	public String getKey() {
		return key;
	}
	public void setKey(String key) {
		this.key = key;
	}
	public String getCode() {
		return code;
	}
	public void setCode(String code) {
		this.code = code;
	}
	public String getLanguage() {
		return language;
	}
	public void setLanguage(String language) {
		this.language = language;
	}
	public String getMessage() {
		return message;
	}
	public void setMessage(String message) {
		this.message = message;
	}
}
